Notifications > Configuring Notifications > Using Tokens in Notifications

Using Tokens in Notifications

Notification messages can be dynamically created using current data in the Point Service, the Current Value Service, or the Facility Service. The identifiers used to create dynamic messages are called "tokens." A token represents a point attribute and can include any property from the point configuration record, the point’s CVS record, or its facility attributes. When the notification is sent, the GNS will replace the token(s) with the appropriate data. Notification messages can also include other points (data values or descriptive information) using a reference point token substitution method.

Tokens and reference points can be used to define a dynamic string of text for both Set and Clear notification messages in the following places:

See the following subsections for more information:

Configure Token Strings

Tokens are configured on the Edit <item> token chooser dialog box, which is accessed by clicking the appropriate Browse button on the right of the Messages page of the Notifications Properties dialog box.

Note: The title of this dialog box depends on the item you are editing: Edit Subject if you are editing and adding tokens to the email subject, Edit Message if you are editing and adding tokens to the notification message, or Edit Wave Message File Path if you are editing and adding tokens to the WAV file path or name.

Edit <item> token chooser

The properties on the Edit <item> dialog box are described below.

Parameter Description

Edit Text

Shows the text and/or tokens that will be displayed.

In the GNS, this field displays the text that will be used in the notification message (subject line, body, or WAV file name). This field may include tokens that refer to the source (current) point that is triggering the notification AND reference tags to other related points.

Drop-Down Menu

Available attributes are categorized into logical groups for ease of lookup. Select a desired category from the drop-down menu.

Attribute

All current attributes defined in the CygNet system. For each category, select the desired value. See Token Categories for a complete list of values by category.

Insert Token

Click to insert the desired token into the Edit Text field. Repeat to display multiple values.

Note: Add static text, spaces between tokens, parentheses, and other punctuation, as desired.

Insert New Line

Click Insert New Line to add a line immediately after the current token.

In the GNS, only notification messages allow the use of multiple lines of text.

Note: While the Edit Text field has focus Ctrl+Enter will insert a new line wherever the cursor is located.

Reference Tag

Note: This option is ONLY available in the General Notification Service.

Use Reference Tag to include other points (data values or descriptive information) in a notification message using reference point token substitution.

See Including Other Points in Notifications for more information about how to format and build up a reference tag for a point other than the point triggering the notification.

Formatting

Display formats can be applied to tokens. The format string is included in the token string within square brackets. An example of a format applied to a value token would be %value[0.0]%, where [0.0] is the display format. See [DisplayFormat] property for more information regarding display formats.

Click Formatting to specify a custom display format for the token. See Displaying Service Monitor Point Date/Time for more information about formatting strings of text.

To Build a String Using Text Tokens

See Using Text Tokens in the CygNet Studio section for general information about using tokens.

  1. Show the Edit <item> dialog box by clicking next to the item for which you want to add a token (Email Subject, Message, or Wav Msg).
  2. Clear the text in the Edit Text field.
  3. Select a category from the drop-down menu.
  4. Select an attribute from the list and click Insert Token to add it to the field. Double-clicking a token will also add it.
  5. Repeat to add more tokens, as desired.
  6. Type in the Edit Text field to add static text, spaces between tokens, parentheses, and other punctuation.
  7. To include a reference tag to a point other than the point triggering the notification, add a desired token, click inside the token, then select Reference Tag to open the Reference Tag dialog box. See Including Other Points in Notifications.
  8. To format a token, click inside the token’s closing percent sign and click Formatting to view the Display Format dialog box. Select an appropriate display formatting option from the Display Format drop-down menu.

Display Format

  1. To add a new line, place the cursor where you want the break and then click Insert New Line. You also can use Ctrl+Enter to insert a new line wherever the cursor is located. (Only body messages support multiple lines.)
  2. Click OK to save the string.

Notification Message Example

The following message uses both static and dynamic text:

%description% alarm on %facility_desc% (%facility_id%). The value is %value% %primaryunits%. Time of alarm: %time%. %facility_desc% is on %facility_table2_desc%.

The resulting notification would be as shown below. The dynamic text is shown in bold.

Differential pressure alarm on SugarCreek East (SUGARCREEK1). The value is 11.37PSI. Time of alarm: 16:06:44 December19 2012. SugarCreek East is on Route 1.

Notification Token Categories

The Edit <item> token chooser categorizes the tokens into logical groupings for ease of lookup. The two GNS specific categories are Notification Current Values and Notification Timeout. See Token Categories in the CygNet Studio section for more information.

Notification Configurable Bit Tokens

The following tokens in the Notification Current Values category can be used to identify the alarm to which a notification maps.

You can include these tokens in a Set or Clear message (or email subject) to identify the name and description of the configurable bit for the point state that initiated the specific notification. The Notification Configurable Bit tokens are relative to the configurable bit that is causing the alarm to occur.

For example, you could configure the following notification message for any limit alarm or warning, without knowing the specific configurable bit number, its designated name, or the current limit configured:

%description% on facility %facility_desc% has a value of %value%, which falls outside the %cfgbitactivename% limit of %cfgbitactivecalcparm1% %units%!

If the notification was triggered because Battery Voltage on Well-1234 fell below the configurable Low Warning value of 3.5, the resulting notification message would read as follows:

Battery Voltage on facility Well-1234 has a value of 3.24567, which falls outside the Low Warning limit of 3.5 volts!

Conveniently, the same formatted message string works without modification if, for instance, the notification was triggered because Tank Level on Tank-789 rose above the configurable High Alarm value of 20 feet. In this case, the resulting notification message would read as follows:

Tank Level on facility Tank-789 has a value of 20.2343, which falls outside the High Alarm limit of 20 feet!

WAV File Example

You use Facility Table 3 in the FAC service to describe the area in which a remote device resides. The entries are Area1, Area2, and Area3. You also have WAV files for each area that are named Area1.wav, Area2.wav, and Area3.wav. When an alarm occurs in a particular area, you want to play that area’s WAV file. In the Wave Msg field in the GNS, you can enter %facility_table3%.wav, for example:

Wave Msg field

When an alarm occurs in Area1, the WAV file name would be substituted with Area1.wav.

Beware of Typographical Errors

If you have a typographical error in a token, the resulting text will include the typo. If you use %Desc% instead of %Description%, the message will include %Desc% as shown below, since %Desc% is not a valid token.

style="margin-left: 0;margin-right: auto;" summary="Code sample">

%Desc% High Alarm on McKee 2-1. Value is 45.0128.

Note: Tokens are formatted in bold to make mistakes easer to identify.


More:

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.